package com.yao.club.service.impl;

import com.yao.club.entity.request.*;
import com.yao.club.entity.result.ResponseEntity;
import com.yao.club.entity.vo.*;
import com.yao.club.service.GoodsOrderService;
import com.yao.club.utils.ResponseUtils;
import org.springframework.stereotype.Service;

@Service
public class GoodsOrderServiceImpl implements GoodsOrderService {
    @Override
    public ResponseEntity<OrderShippingCostResultVO> shippingTemplateInfo(OrderShippingCostRequestEntity request) {
        OrderShippingCostResultVO orderResultVO = new OrderShippingCostResultVO();
        double shippingCost = 0.0;
        int totalItems = 0;

        for (OrderShippingCostRequestEntity.GoodsInfo goodsInfo : request.getGoodsInfoList()) {
            totalItems += goodsInfo.getNum();
        }
        //计算运费
        if (totalItems > 0) {
            shippingCost = 5.0 + (totalItems - 1) * 2.0;
        }
        orderResultVO.setShippingPrice(shippingCost);

        return ResponseUtils.success(orderResultVO);
    }

    @Override
    public ResponseEntity<OrderPlaceOrderCouponSelectResultVO> placeOrderCouponSelect(OrderCouponMaxDisRequest entity) {

        OrderPlaceOrderCouponSelectResultVO orderCouponMaxDisResultVO = new OrderPlaceOrderCouponSelectResultVO();

        return ResponseUtils.success(orderCouponMaxDisResultVO);
    }

    @Override
    public ResponseEntity<OrderMallGoodsAddResultVO> mallGoodsAdd(OrderMallGoodsAddRequest entity) {
        OrderMallGoodsAddResultVO orderMallGoodsAddResultVO = new OrderMallGoodsAddResultVO();
        return ResponseUtils.success(orderMallGoodsAddResultVO);
    }

    @Override
    public ResponseEntity<OrderCashDetailResultVO> orderCashDetail(OrderCashDetailRequest entity) {
        OrderCashDetailResultVO orderCashDetailResultVO = new OrderCashDetailResultVO();
        return ResponseUtils.success(orderCashDetailResultVO);
    }



    @Override
    public ResponseEntity<OrderPayCostTrialResultVO> payCostTrial(OrderPayCostTrialRequest entity) {
        OrderPayCostTrialResultVO orderPayCostTrialResultVO = new OrderPayCostTrialResultVO();
        return ResponseUtils.success(orderPayCostTrialResultVO);
    }

    @Override
    public ResponseEntity<OrderCouponMaxDisResultVO> couponMaxDis(OrderCouponMaxDisRequest entity) {
        OrderCouponMaxDisResultVO orderCouponMaxDisResultVO = new OrderCouponMaxDisResultVO();
        return ResponseUtils.success(orderCouponMaxDisResultVO);
    }
}
